/**
 * Created by Administrator on 2017/4/18.
 */
var Step1 = require('./step-1.js');
var Step2 = require('./step-2.js');
var Step3 = require('./step-3.js');

var FindPwd = React.createClass({
    getDefaultProps:function(){
        return{
            step1:this.props.step1,
            step2:this.props.step2,
            step3:this.props.step3
        }
    },
    getInitialState:function(){
        return{
            title:PageDM.setTitle.value
        }
    },
    componentDidMount:function(){
        var _this = this;
        UEventHub.on(PageDM.setTitle.dmbind + UI_EVENT_CONST.SET_UDM_VALUE_EVENT, function(v){
            console.log(v);
            _this.setState({
                title:v
            });
        });

        UEventHub.on('next',function(bool){
            if(bool == 'step1'){
                ReactDOM.render(<Step2 pagedm={_this.props.step2}/>,_this.refs.container);

                _this.refs.lineicon1.className = "step1";
                _this.refs.lineicon2.className = 'step2 current';
            }else if(bool == 'step2'){
                ReactDOM.render(<Step3 pagedm={_this.props.step3}/>,_this.refs.container);

                _this.refs.lineicon2.className = "step2";
                _this.refs.lineicon3.className = 'step3 current';
            }
        });
    },
    render:function(){
        return(
            <div className="container mod-reg">
                <span className="angle angle-top"></span>
                <span className="angle angle-bottom"></span>
                <div className="reset-pwd"><span className="pwd-title">{this.state.title}</span></div>
                <div className="form validate-form">
                    <div className="validate-tab">
                        <ul ref="stepline">
                            <li ref="lineicon1" className="step1 current"><span>验证账号</span></li>
                            <li ref="lineicon2" className="step2"><span>重置密码</span></li>
                            <li ref="lineicon3" className="step3"><span>完成</span></li>
                        </ul>
                    </div>
                    <div ref="container">
                        <Step1/>
                    </div>
                    <div className="clear"></div>
                </div>
            </div>
        )
    }
});
module.exports = FindPwd;